<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> 

<!-- S 日期处理 -->
<c:if test="${filterInfo.headType=='Date'}">
<div class="col-md-5">
    <%-- 定义变量 --%>
    <c:set var="isSingle" value="${fn:length(filterInfo.values)==1}" scope="page"/>
    <c:set var="isMulti" value="${fn:length(filterInfo.values)>1}" scope="page"/>
    
    <!-- S 单数据处理 -->
    <c:if test="${isSingle}">
        <c:forEach items="${filterInfo.values}" var="value">
            <div class="select-date form-inline moudle-margin-5 pull-left">
                <c:if test="${value.condition=='Between'}" var="betweenFlag">
	               	<div class="form-group">
	                    <input name="${value.name}${value.startSuffix}" type="date" class="form-control">
	                </div>
	                <div class="form-group">
	                    <label> 至 </label>
	                    <input name="${value.name}${value.endSuffix}" type="date" class="form-control">
	                </div>
                </c:if>
                <c:if test="${!betweenFlag}">
                	<div class="form-group">
	                    <input name="${value.name}" type="date" class="form-control">
	                </div>
            	</c:if>
                <div class="btn-group" style="margin-left:5px;">
                    <button type="button" class="btn btn-default dropdown-toggle js_filterButtonClick" data-toggle="dropdown">
                        按${value.comment}查询 <span ></span>
                    </button>
                </div>
            </div>
        </c:forEach>
        
    </c:if>
    <!-- E 单数据处理 -->
    
    <!-- S 多数据处理 -->
    <c:if test="${isMulti}">
        <div class="select-date form-inline moudle-margin-5 pull-left js_filter_common">
			<c:if test="${filterInfo.values[0].condition=='Between'}" var="betweenFlag">
				<div class="form-group">
	                <input name="${filterInfo.values[0].name}${filterInfo.values[0].startSuffix}" type="date" class="form-control input-sm js_input_date_start">
	            </div>
	            <div class="form-group">
	                <label> 至 </label>
	                <input name="${filterInfo.values[0].name}${filterInfo.values[0].endSuffix}" type="date" class="form-control input-sm js_input_date_end">
	            </div>
			</c:if>
			<c:if test="${!betweenFlag}">
				<input name="${filterInfo.values[0].name}${filterInfo.values[0]}" type="date" class="form-control input-sm">
			</c:if>
			<div class="btn-group" >
                <button type="button" class="btn btn-sm btn-default dropdown-toggle js_filter_commonMutilButton" data-toggle="dropdown" >按${filterInfo.values[0].comment}查询 <span class="caret"></span></button>
                <ul class="dropdown-menu">
                    <c:forEach items="${filterInfo.values}" var="value">
                        <li inputStartName="${value.name}${value.startSuffix}" inputEndName="${value.name}${value.endSuffix}" onclick="js_filter_mutilCommon_date(this)"><a href="javascript:void(0)">按${value.comment}查询</a></li>
                    </c:forEach>
                </ul>
               <button class="btn btn-sm btn-default js_filterButtonClick" type="button">查询</button>
            </div>
            
            <script type="text/javascript">
                function js_filter_mutilCommon_date(thisTarget){
                    var $range = $(thisTarget).closest(".js_filter_common");
                    $range.find(".js_filter_commonMutilButton").html($(thisTarget).text()+"<span class=\"caret\"></span>")
                    $range.find(".js_input_date_start").attr("name", $(thisTarget).attr("inputStartName"))
                    $range.find(".js_input_date_end").attr("name", $(thisTarget).attr("inputEndName"))
                }
            </script>
        </div>
    </c:if>
    <!-- E 多数据处理  -->
</div>
</c:if>
<!-- E 日期处理 -->
   